﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.ComponentModel;


namespace employee.Controls
{
    public class gridEmployee : common.controls.baseDataGridView 
    {
        public enum ColumnNames
        {
            Code,FullName,DOB
        };

        public gridEmployee()
        {
        }

        public override void LockEdit(bool lockStat)
        {
            base.LockEdit(true); 
        }
        public override void Init()
        {
            base.Init();
            data.baseDS.employeeDataTable dummyTbl = DataAccess.DataCache.myBaseDS.employee;

            // =============================
            // detailGrid
            // =============================

            // Code
            common.controls.DataGridViewTextBoxColumnExt code = new common.controls.DataGridViewTextBoxColumnExt();
            code.Uppercase = true;
            code.DataPropertyName = dummyTbl.emCodeColumn.ColumnName;
            code.HeaderText = "Mã số";
            code.Name = ColumnNames.Code.ToString();
            code.Width = 130;

            // fullName
            common.controls.DataGridViewTextBoxColumnExt fullName = new common.controls.DataGridViewTextBoxColumnExt();
            fullName.DataPropertyName = dummyTbl.fullNameColumn.ColumnName;
            fullName.HeaderText = "Họ và tên";
            fullName.Name = ColumnNames.FullName.ToString();
            fullName.Width = 130;

            // dob
            common.controls.DataGridViewTextBoxColumnExt dob = new common.controls.DataGridViewTextBoxColumnExt();
            dob.DataPropertyName = dummyTbl.dobColumn.ColumnName;
            dob.DefaultCellStyle = application.SysLibs.CellTypeDATE();
            dob.HeaderText = "Ngày.sinh";
            dob.Name = ColumnNames.DOB.ToString();
            dob.Width = 85;

            this.Columns.Clear();
            this.Columns.AddRange(new DataGridViewColumn[] { code, fullName,dob});

            this.myAutoFitColumn = ColumnNames.FullName.ToString();
            this.AutoFit();
        }
    }
}
